package predatorpreytest.meso.builder;

import repast.simphony.space.grid.Grid;
import PredatorPrey.Grass;
import PredatorPrey.Sheep;
import util.PredatorPreyScenarioBuilder;

public class GrassSheepScenarioBuilder extends PredatorPreyScenarioBuilder {

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	protected void createAgents() {
		// create a new grass agent..
		Grass grass = this.getEnvironment().createGrass("grass1",
				this.getContext(), 20, 30);
		while(!grass.isAlive()){
			grass = this.getEnvironment().createGrass("grass1",
					this.getContext(), 20, 30);
			if (grass.isAlive()) {
				break;
			}
		}
		// add to the test context...
		getContext().add(grass);

		// create Sheep agent
		Sheep sheep = this.getEnvironment().createFakeSheep("sheep1");
		// add to the test context...
		getContext().add(sheep);

		// move sheep agent to its context.
		// Get the patch grid from the context
		Grid patch = (Grid) getContext().getProjection("Simple Grid");
		patch.moveTo(sheep, 20, 30);
	}

}
